package com.geely.design.pattern.behavioral.command;

import java.util.ArrayList;
import java.util.List;

public class Staff implements Command{ // 这里可选择实现Command接口
    private List<Command> commandList = new ArrayList<>();

    public void addCommand(Command command) {
        commandList.add(command);
    }

    @Override
    public void execute() {
        for (Command command : commandList) { // 添加完命令之后,挨个命令执行
            command.execute();
        }
        commandList.clear();
    }
}
